﻿<phone:PhoneApplicationPage 
    x:Class="TodayHumor.Login"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:TodayHumor"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.BackgroundColor="{StaticResource PhoneAccentColor}"
    shell:SystemTray.IsVisible="True">
    
    <phone:PhoneApplicationPage.Resources>
        <local:SettingsModule x:Key="settings"/>
        <local:BoolToOpacityBackConverter x:Key="BoolToOpacityBackConverter"/>
        <local:BoolToOpacityConverter x:Key="BoolToOpacityConverter"/>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="Transparent" Language="ko-kr">
        <Grid Height="110" VerticalAlignment="Top">
            <TextBlock Text="로그인" FontSize="54"
                       VerticalAlignment="Bottom" Margin="15,0,0,15"/>
        </Grid>
        

        <StackPanel x:Name="ContentPanel" Margin="0,110,0,0" Background="#202020">
            <StackPanel Margin="15,25,15,0">
                <TextBlock FontSize="24" TextWrapping="Wrap" Margin="0,0,0,15">
                글 쓰기, 댓글 달기 등의 오늘의 유머 서비스를 이용하시기 위해서는 로그인이 필요합니다.
                </TextBlock>
                <toolkit:PhoneTextBox x:Name="LoginIdTextBox" Hint="아이디" Width="470" TextChanged="LoginTextBoxTextChanged"
                                  Text="{Binding LoginId, Source={StaticResource settings}}"/>
                <Grid>
                    <TextBox x:Name="PasswordWatermark" TextWrapping="Wrap" Text="비밀번호" Foreground="#A4A4A4" IsHitTestVisible="False" Padding="5,3"
                     Width="470" Margin="-10,0,0,0" Opacity="{Binding AutoLogin, Source={StaticResource settings}, Converter={StaticResource BoolToOpacityBackConverter}}"/>
                    <PasswordBox x:Name="LoginPwTextBox" Width="470" Margin="-10,0,0,0" Opacity="{Binding AutoLogin, Source={StaticResource settings}, Converter={StaticResource BoolToOpacityConverter}}" GotFocus="LoginPwTextBox_GotFocus" LostFocus="LoginPwTextBox_LostFocus"
                             Padding="5,3" Password="{Binding LoginPw, Source={StaticResource settings}}"/>
                </Grid>
                <CheckBox x:Name="AutoLoginCheckBox" Content="자동 로그인" Margin="-10,0,0,0" IsChecked="{Binding AutoLogin, Source={StaticResource settings}}"/>
            </StackPanel>
        </StackPanel>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar Opacity=".8">
            <shell:ApplicationBar.Buttons>
                <shell:ApplicationBarIconButton IconUri="Images/Icons/check.png" Text="로그인" Click="LoginButtonClick"/>
                <shell:ApplicationBarIconButton IconUri="Images/Icons/close.png" Text="뒤로" Click="BackBtnClick"/>
            </shell:ApplicationBar.Buttons>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
</phone:PhoneApplicationPage>
